package com.wangyadong.hobby.schedule.jobtask.mybatis;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/8/29:30
 **/
public class AutoSaveThread extends Thread {

    private final Document document;

    public AutoSaveThread(Document document) {
        this.document = document;
    }

    @Override
    public void run() {
        while (true) {
            try {
                document.save();
                TimeUnit.SECONDS.sleep(1);
                System.out.println("per second exector ===========================>");
            } catch (IOException | InterruptedException e) {
                e.printStackTrace();
                break;
            }
        }
    }
}
